package provice_match2022;

public class B {
	public static void main(String[] args) {
		int count = 0;
		for (int i = 2022; i < 2022222022; i++) {
			String str = String.valueOf(i);
			if (isPal(str) && check(str)) {
				count ++;
			}
		}
		System.out.print(count);
	}
	
	private static boolean check(String n) {
		int len = n.length() / 2;
		for (int i = 1; i <= len; i++) {
			if (n.charAt(i) < n.charAt(i - 1)) {
				return false;
			}
		}
		return true;
	}
	
	private static boolean isPal(String n) {
		int left = 0, right = n.length() - 1;
		while (left < right) {
			if (n.charAt(left) != n.charAt(right)) {
				return false;
			}
			left ++;
			right --;
		}
		return true;
	}
}
